{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f289dd5a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 店铺无线流量\n",
    "import webbrowser\n",
    "from datetime import datetime, timedelta\n",
    "\n",
    "# 定义时间段\n",
    "start_date = datetime(2023, 12, 21)\n",
    "end_date = datetime(2023, 12, 25)\n",
    "\n",
    "# 循环遍历日期范围\n",
    "current_date = start_date\n",
    "while current_date <= end_date:\n",
    "    # 格式化日期\n",
    "    formatted_date = current_date.strftime(\"%Y-%m-%d\")\n",
    "\n",
    "    # 构建链接\n",
    "    url = f\"https://sycm.taobao.com/flow/gray/excel.do?spm=a21ag.11910098.sycm-flow-shop-source-construction-flow-source-self-table-new.1.9afe50a5VcaARz&_path_=v4/excel/shop/source/v3&device=2&dateType=day&dateRange={formatted_date}|{formatted_date}&belong=all\"\n",
    "\n",
    "    # 在默认浏览器中打开链接\n",
    "    webbrowser.open(url)\n",
    "\n",
    "    # 增加一天\n",
    "    current_date += timedelta(days=1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ef7d32ce",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 全量商品\n",
    "import webbrowser\n",
    "from datetime import datetime, timedelta\n",
    "\n",
    "# 定义时间段\n",
    "start_date = datetime(2024, 1, 8)\n",
    "end_date = datetime(2024, 1, 8)\n",
    "\n",
    "# 循环遍历日期范围\n",
    "current_date = start_date\n",
    "while current_date <= end_date:\n",
    "    # 格式化日期\n",
    "    formatted_date = current_date.strftime(\"%Y-%m-%d\")\n",
    "\n",
    "    # 构建链接\n",
    "    url = f\"https://sycm.taobao.com/cc/cockpit/marcro/item/excel/top.json?spm=a21ag.12100459.0.0.284550a5fl0ZSd&dateRange={formatted_date}|{formatted_date}&dateType=day&pageSize=10&page=1&order=desc&orderBy=payAmt&dtUpdateTime=false&keyword=&follow=false&cateId=&cateLevel=&guideCateId=&device=0&indexCode=itmUv%2CitemCartCnt%2CpayItmCnt%2CpayAmt%2CpayRate\"\n",
    "\n",
    "    # 在默认浏览器中打开链接\n",
    "    webbrowser.open(url)\n",
    "\n",
    "    # 增加一天\n",
    "    current_date += timedelta(days=1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "aad4c7c6",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 单品二级流量（淘客）\n",
    "import webbrowser\n",
    "from datetime import datetime, timedelta\n",
    "\n",
    "# 定义时间段\n",
    "start_date = datetime(2024, 1, 2)\n",
    "end_date = datetime(2024, 1, 7)\n",
    "item_id_variable = \"743202760241\"\n",
    "\n",
    "# 循环遍历日期范围\n",
    "current_date = start_date\n",
    "while current_date <= end_date:\n",
    "    # 格式化日期\n",
    "    formatted_date = current_date.strftime(\"%Y-%m-%d\")\n",
    "\n",
    "    # 构建链接\n",
    "    url = f\"https://sycm.taobao.com/flow/excel.do?_path_=v6/excel/item/crowdtype/source/v3&belong=all&dateType=day&dateRange={formatted_date}|{formatted_date}&crowdType=all&device=2&itemId={item_id_variable}&device=2&order=desc&orderBy=uv\"\n",
    "\n",
    "    # 在默认浏览器中打开链接\n",
    "    webbrowser.open(url)\n",
    "\n",
    "    # 增加一天\n",
    "    current_date += timedelta(days=1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "950596b5",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 手淘流量(三级流量)\n",
    "import webbrowser\n",
    "from datetime import datetime, timedelta\n",
    "\n",
    "# 定义时间段\n",
    "start_date = datetime(2024, 1, 8)\n",
    "end_date = datetime(2024, 1, 8)\n",
    "item_id_variable = \"719355771778\"\n",
    "\n",
    "# 循环遍历日期范围\n",
    "current_date = start_date\n",
    "while current_date <= end_date:\n",
    "    # 格式化日期\n",
    "    formatted_date = current_date.strftime(\"%Y-%m-%d\")\n",
    "\n",
    "    # 构建链接\n",
    "    url = f\"https://sycm.taobao.com/flow/excel.do?_path_=v3/new/excel/item/source/detail/v3&order=desc&orderBy=uv&dateType=day&dateRange={formatted_date}|{formatted_date}&itemId={item_id_variable}&device=2&pageId=23.s1150&pPageId=30&pageLevel=2&childPageType=se_keyword&belong=all\"\n",
    "\n",
    "    # 在默认浏览器中打开链接\n",
    "    webbrowser.open(url)\n",
    "\n",
    "    # 增加一天\n",
    "    current_date += timedelta(days=1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fb565b6f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
